<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/jsp/common/taglibs.jsp"%>


<!DOCTYPE html>
<html>
<head>
<title>security system</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link rel="stylesheet"
	href="<c:url value="/css/bootstrap.min.css"></c:url>">

</head>
<body>
	<nav class="navbar navbar-inverse" role="navigation">
		<!-- Brand and toggle get grouped for better mobile display -->
		<div class="navbar-header" style="margin:10px;">
			<button type="button" class="navbar-toggle" data-toggle="collapse"
				data-target="#bs-example-navbar-collapse-1">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="#">UUC Bioengineering Ltd.</a>
		</div>
		<!-- Collect the nav links, forms, and other content for toggling -->
		<div class="collapse navbar-collapse"
			id="bs-example-navbar-collapse-1" style="margin:10px;">
			<ul class="nav navbar-nav">
				<li><a
					href="<s:url namespace="/security" action="homeAction"/>">Dynamical
						Map</a></li>
				<li class="active"><a
					href="<s:url namespace="/security" action="loadLogAction"/>">Access Log</a></li>
				<li><a
					href="<s:url namespace="/security" action="loadErrorReportAction"/>">Error
						Handle</a></li>
				<li><a
					href="<s:url namespace="/security" action="loadFireReportAction"/>">Fire
						Alarm</a></li>
			</ul>
			<ul class="nav navbar-nav navbar-right" style="margin-right:20px;">
				<li><a href="#">${loginedAdmin.admin_ID}</a></li>
				<li><a href="#">${loginedAdmin.admin_Username}</a></li>
				<li><a href="#">Security Administrator</a>
				</li>
				<li><a
					href='<s:url namespace="/system" action="adminLogout"></s:url>'>Log
						out</a></li>
			</ul>
		</div>
		<!-- /.navbar-collapse -->
	</nav>
	<div class="container">
		<div class="row" style="margin-top:10px;margin-bottom:30px;">
			<s:form action="loadLogAction" method="post" namespace="/security">
				<div class="row">
					<div class="col-lg-12">
					<div class="col-lg-1 col-lg-offset-1">
					<label>Operator</label>
					</div>
					<div class="col-lg-2">
						<s:textfield name="helper.operator" cssClass="btn-large"
							cssStyle="margin-top:5px;height:30px;width:150px;"></s:textfield>
					</div>
						<div class="col-lg-1 ">
						 <label>DoorID</label>
						</div>
						<div class="col-lg-3">
							<s:select cssClass="form-control input-lg" name="helper.doorID"
								headerKey="" headerValue="===Choose===" list="doorList"
								listKey="door_ID" listValue="door_ID"></s:select>
						</div>
						<div class="col-lg-1">
							<s:submit value=" Query " style="margin: 5px 0px 15px 10px;"
								cssClass="btn btn-success"></s:submit>
						</div>
					</div>
				</div>
			</s:form>
		</div>
		<div class="row">
			<div class="col-lg-10 col-lg-offset-1">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>LogID</th>
							<th>Content</th>
							<th>Operator</th>
							<th>Date</th>
						</tr>
					</thead>
					<tbody>
						<s:iterator value="page.pageContent">
							<tr>
								<td><s:property value="log_ID" /></td>
								<td><s:property value="log_Content" /></td>
								<td><s:property value="operator" /></td>
								<td><s:property value="log_Date" /></td>
							</tr>
						</s:iterator>
					</tbody>
				</table>
			</div>
		</div>
		<div class="row">
		<div class="col-lg-offset-1">
			<div id="pageinfo">
				Total
				<s:property value="page.totalRecNum" />
				Records, Current View
				<s:property value="page.startIndex" />
				-
				<s:property value="page.endIndex" />
				,
				<s:property value="page.pageNo" />
				/
				<s:property value="page.totalPageNum" />
				Page |
				<s:if test="page.pageNo>1">
					<span class="linkspan" onclick="doQuery(1)">First</span>&nbsp;
	           </s:if>
				<s:if test="page.prePage">
					<span class="linkspan"
						onclick="doQuery(<s:property value="page.pageNo-1"/>)">Previous</span>&nbsp;
	           </s:if>
				<s:if test="page.nextPage">
					<span class="linkspan"
						onclick="doQuery(<s:property value="page.pageNo+1"/>)">Next</span>&nbsp;
	           </s:if>
				<s:if test="page.pageNo!=page.totalPageNum">
					<span class="linkspan"
						onclick="doQuery(<s:property value="page.totalPageNum"/>)">Last</span>&nbsp;
	           </s:if>
				| <input type="text" id="appendedInputButton" class="span1"
					onkeypress="onlynumber();">
				<button class="btn"
					onclick="doQuery($('#appendedInputButton').val());">Go</button>

			</div>
		</div>
	</div>
	</div>
	<script src="<c:url value="/js/jquery-1.9.1.min.js"></c:url>"></script>
	<script src="<c:url value="/js/bootstrap.min.js"></c:url>"></script>
	<script type="text/javascript">
	function doQuery(pageno){
		if(pageno<1 || pageno><s:property value="page.totalPageNum"/>){
			alert("Valid page from: 1-<s:property value="page.totalPageNum"/>");
			$('appendedInputButton').select();
              return;
		}
		var f=document.forms[0];
            f.action=f.action+"?page.pageNo="+pageno;
            f.submit();
       }
            
	
</script>
</body>
</html>
